class Student:
    school = "郑州高新区小学"

    def __init__(self, name, age):
        self.name = name
        self.age = age

    def show_info(self):
        print(f"hi,"
              f"姓名：{self.name},年龄{self.age}")

    # 静态方法
    @staticmethod
    def staticmethod():
        print("staticmethod"
              "", f"{Student.school}")

    #  类方法
    @classmethod
    def class_method(cls):
        print("class_method", cls.school)


# 和类有关系，
Student.class_method()
Student.staticmethod()
print(Student.school)

# 和实例有关
stu1 = Student("小明", 19)
stu2 = Student(name="小强", age=18)
stu3 = Student(age=20, name="大鹏")
stu4 = Student("marry", 21)

students = [stu1, stu2, stu3, stu4]
for stu in students:
    stu.show_info()

# 实例动态绑定属性
stu = Student("yujikuan", 30)
stu.addr = "河南郑州高新区"

print(stu.name, stu.age, stu.addr)


# 实例动态绑定方法
def say_hi():
    print("say Hi")


stu.my_fun = say_hi
stu.my_fun()
